package pers.zxk.jlytnews.dao.impl;

import pers.zxk.jlytnews.dao.LogDao;
import pers.zxk.jlytnews.util.DBconn;

import java.sql.SQLException;

public class LogDaoImpl implements LogDao {
    @Override
    public boolean addLog(String type, String action1, String action2, String action3, String description,
                          String contents, String user, String datetime) throws SQLException, ClassNotFoundException {
        boolean flag = false;
        DBconn.init();
        int i = DBconn.addUpdDel("insert into tb_logs (type,action1,action2,action3,description,contents,user,datetime) " +
                "values('" + type + "','" + action1 + "','" + action2 + "','" + action3 + "','"
                + description + "','" + contents + "','" + user + "','" + datetime + "')");
        if (i > 0) {
            flag = true;
        }
        DBconn.closeConn();
        return flag;
    }

    @Override
    public String getLog(String type, String datetime) throws SQLException, ClassNotFoundException {
        //todo
        return null;
    }
}
